package com.fenghongzhang.lib_core.utils

import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.launcher.ARouter
import com.fenghongzhang.lib_core.cons.IntentData

object ARouterUtils {
    fun jump(page: String, id: String = "", name: String = "", bool: Boolean? = null) {
        val navigation = ARouter.getInstance().build(page)
        if (id.isNotEmpty())
            navigation.withString(IntentData.KEY_ID, id)
        if (name.isNotEmpty())
            navigation.withString(IntentData.KEY_NAME, name)
        if (bool != null)
            navigation.withBoolean(IntentData.KEY_BOOLEAN, bool)
        navigation.navigation()
    }

    fun jumpWith2ID(page: String, id1: String = "", id2: String = "") {
        val navigation = ARouter.getInstance().build(page)
        navigation.withString(IntentData.KEY_ID, id1)
        navigation.withString(IntentData.KEY_ID_2, id2)
        navigation.navigation()
    }


    /** 打开其他用户主页 */
//    fun jumpUserHomepage(memberId: String) {
//        UserPageActivity.jump(memberId)
//    }
//
//
//    fun jumpLogin(activity: AppCompatActivity?) {
//        if (activity == null) {
//            LoginActivity.jump()
//        } else {
//            LoginHelper(activity).jumpLogin()
//        }
//    }
//
//    /**
//     * 跳转到POI地名搜索
//     */
//    fun jumpAddressSelector(formItem: FormInfoItem) {
//        AddressSelectorActivity.event = MapAddressSelectEvent(formItem)
//
//        val navigation = ARouter.getInstance().build(Router.Ui.AddressSelectorActivity)
//        navigation.navigation()
//    }
//
//    /**
//     * 跳转到地图选点页面
//     */
//    fun jumpMapPointSelector(formItem: FormInfoItem) {
//        AddressSelectorActivity.event = MapAddressSelectEvent(formItem)
//
//        val navigation = ARouter.getInstance().build(Router.Ui.MapPointSelectorActivity)
//        navigation.navigation()
//    }

    fun backToHomeProfile() {
        // 返回首页
        ARouter.getInstance()
            .build(Router.Ui.MainActivity)
            .navigation()
    }
}